﻿
#include "ZKYPXX.h"
#include "afxdialogex.h"
#include "../../DIO/DIO.h"
#include "../../DAO/DAO.h"
#include "../../UI/DIO/LOGIN.h"
using namespace DIO;

CString strktqbh;
CString strzkbh;

// ZKYPXX 对话框

IMPLEMENT_DYNAMIC(ZKYPXX, CDialogEx)

ZKYPXX::ZKYPXX(CWnd* pParent /*=nullptr*/)
	: CDialogEx(IDD_ZKYPXX, pParent)
{

}

ZKYPXX::~ZKYPXX()
{
}

void ZKYPXX::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_ZKYPXX_LIST, ZKYPXXLIST);
	DDX_Control(pDX, IDC_COMBO_ZKYPXXKTQBH, m_zkypxxktqbh);
	DDX_Control(pDX, IDC_COMBO_ZKYPXXZKBH, m_zkypxxzkbh);
	DDX_Control(pDX, IDC_COMBO_ZKYPXXKTMC, m_zkypxxktmc);
}


BEGIN_MESSAGE_MAP(ZKYPXX, CDialogEx)

	ON_CBN_SELCHANGE(IDC_COMBO_ZKYPXXKTQBH, &ZKYPXX::OnCbnSelchangeComboZkypxxktqbh)
	ON_CBN_SELCHANGE(IDC_COMBO_ZKYPXXZKBH, &ZKYPXX::OnCbnSelchangeComboZkypxxzkbh)
	ON_CBN_SELCHANGE(IDC_COMBO_ZKYPXXKTMC, &ZKYPXX::OnCbnSelchangeComboZkypxxktmc)
	ON_BN_CLICKED(IDC_ZKYPXX_ADD1, &ZKYPXX::OnBnClickedZkypxxAdd1)
END_MESSAGE_MAP()


// ZKYPXX 消息处理程序


BOOL ZKYPXX::OnInitDialog()
{
	CDialogEx::OnInitDialog();

	// TODO:  在此添加额外的初始化
	
	//GKTitleName = "钻孔样品信息";
	DWORD dwStyle = ZKYPXXLIST.GetExtendedStyle();
	//ZKYPXXLIST.SetExtendedStyle(dwStyle | LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT);
	//ZKYPXXLIST.InsertColumn(0, _T(" "), LVCFMT_CENTER, 200);
	//ZKYPXXLIST.InsertColumn(1, _T(" "), LVCFMT_CENTER, 140);
	//ZKYPXXLIST.InsertColumn(2, _T(" "), LVCFMT_CENTER, 140);
	//ZKYPXXLIST.InsertColumn(3, GKTitleName, LVCFMT_CENTER, 140);
	//ZKYPXXLIST.InsertColumn(4, _T(" "), LVCFMT_CENTER, 140);
	//ZKYPXXLIST.InsertColumn(5, _T(" "), LVCFMT_CENTER, 140);
	//ZKYPXXLIST.InsertColumn(7, _T(" "), LVCFMT_CENTER, 140);

	//dwStyle = ZKYPXXLIST.GetExtendedStyle();
	ZKYPXXLIST.SetExtendedStyle(dwStyle | LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT);
	ZKYPXXLIST.InsertColumn(0, _T("MDBTAD（勘探区编号）"), LVCFMT_CENTER, 200);
	ZKYPXXLIST.InsertColumn(1, _T("GCJCBN(钻孔编号)"), LVCFMT_CENTER, 140);
	ZKYPXXLIST.InsertColumn(2, _T("PKHFB（样品编号"), LVCFMT_CENTER, 140);
	ZKYPXXLIST.InsertColumn(3, _T("TKACCF（样品起始深度）"), LVCFMT_CENTER, 140);
	ZKYPXXLIST.InsertColumn(4, _T("TKACCG（样品终止深度）"), LVCFMT_CENTER, 140);
	ZKYPXXLIST.InsertColumn(5, _T("GCLCAA（样品长度）"), LVCFMT_CENTER, 140);
	ZKYPXXLIST.InsertColumn(6, _T("矿体名称"), LVCFMT_CENTER, 140);
	ZKYPXXLIST.InsertColumn(7, _T("矿体品位值"), LVCFMT_CENTER, 140);
	
	m_zkypxxktqbh.AddString(TEXT("选择勘探区编号"));
	m_zkypxxktqbh.SetCurSel(0);
	m_zkypxxktqbh.AddString(TEXT("654324000000001"));
	m_zkypxxktqbh.AddString(TEXT("1"));

	m_zkypxxzkbh.AddString(TEXT("选择钻孔编号"));
	m_zkypxxzkbh.SetCurSel(0);
	m_zkypxxzkbh.AddString(TEXT("JZK1306"));
	m_zkypxxzkbh.AddString(TEXT("ZK0103"));
	m_zkypxxzkbh.AddString(TEXT("ZK0104"));
	m_zkypxxzkbh.AddString(TEXT("ZK0105"));
	m_zkypxxzkbh.AddString(TEXT("JZK106"));
	m_zkypxxzkbh.AddString(TEXT("ZK0107"));
	m_zkypxxzkbh.AddString(TEXT("ZK0108"));
	m_zkypxxzkbh.AddString(TEXT("ZK0109"));


	m_zkypxxktmc.AddString(TEXT("输入矿体名称"));
	m_zkypxxktmc.SetCurSel(0);
	m_zkypxxktmc.AddString(TEXT("铜"));
	m_zkypxxktmc.AddString(TEXT("锌"));
	m_zkypxxktmc.AddString(TEXT("硫"));


	return TRUE;  // return TRUE unless you set the focus to a control
				  // 异常: OCX 属性页应返回 FALSE
}


//void ZKYPXX::OnBnClickedZkypxxAdd()
//{
//	// TODO: 在此添加控件通知处理程序代码
//	OreGrade_ST drill;
//
//	CString ZKYPX_ktqbh;
//	//GetDlgItem(IDC_ZKYPXX_KTQBH)->GetWindowText(ZKYPX_ktqbh);
//	drill.kantanqu_no = ZKYPX_ktqbh;
//
//	CString ZKYPX_zkbh;
//	//GetDlgItem(IDC_ZKYPXX_ZKBH)->GetWindowText(ZKYPX_zkbh);
//	drill.drill_no = ZKYPX_ktqbh;
//
//	CString ZKYPX_ypbh;
//	GetDlgItem(IDC_ZKYPXX_YPBH)->GetWindowText(ZKYPX_ypbh);
//	drill.sample_no = ZKYPX_ypbh;
//
//	CString ZKYPX_ktmc;
//	GetDlgItem(IDC_ZKYPXX_KTMC)->GetWindowText(ZKYPX_ktmc);
//	drill.name = ZKYPX_ktmc;
//
//	CString ZKYPX_ktpwz;
//	GetDlgItem(IDC_ZKYPXX_YPZZSD)->GetWindowText(ZKYPX_ktpwz);
//	double grade = atof(ZKYPX_ktpwz);
//	drill.grade = grade;
//
//	int nindex = ZKYPXXLIST.InsertItem(1, ZKYPX_ypbh);
//	ZKYPXXLIST.SetItemText(nindex, 1, ZKYPX_ktmc);
//	ZKYPXXLIST.SetItemText(nindex, 2, ZKYPX_ktpwz);
//
//	UserInsertDMZK04062(drill);
//}


void ZKYPXX::OnCbnSelchangeComboZkypxxktqbh()
{
	// TODO: 在此添加控件通知处理程序代码
		//获取某个索引
	int index = m_zkypxxktqbh.GetCurSel();
	//获得勘探区编号
	m_zkypxxktqbh.GetLBText(index, strktqbh);
}


void ZKYPXX::OnCbnSelchangeComboZkypxxzkbh()
{
	// TODO: 在此添加控件通知处理程序代码
		//获取某个索引
	int index = m_zkypxxktqbh.GetCurSel();
	//获得勘探区编号
	m_zkypxxzkbh.GetLBText(index, strzkbh);
}


void ZKYPXX::OnCbnSelchangeComboZkypxxktmc()
{
	// TODO: 在此添加控件通知处理程序代码
	int index = m_zkypxxktqbh.GetCurSel();
	//获得勘探区编号
	m_zkypxxzkbh.GetLBText(index, strzkbh);
}


void ZKYPXX::OnBnClickedZkypxxAdd1()
{
	// TODO: 在此添加控件通知处理程序代码
		// TODO: 在此添加控件通知处理程序代码
	OreGrade_ST drill;

	CString ZKYPX_ktqbh;
	//GetDlgItem(IDC_ZKYPXX_KTQBH)->GetWindowText(ZKYPX_ktqbh);
	drill.kantanqu_no = ZKYPX_ktqbh;

	CString ZKYPX_zkbh;
	//GetDlgItem(IDC_ZKYPXX_ZKBH)->GetWindowText(ZKYPX_zkbh);
	drill.drill_no = ZKYPX_ktqbh;

	CString ZKYPX_ypbh;
	GetDlgItem(IDC_ZKYPXX_YPBH)->GetWindowText(ZKYPX_ypbh);
	drill.sample_no = ZKYPX_ypbh;

	CString ZKYPX_ktmc;
	GetDlgItem(IDC_ZKYPXX_KTMC)->GetWindowText(ZKYPX_ktmc);
	drill.name = ZKYPX_ktmc;

	CString ZKYPX_ktpwz;
	GetDlgItem(IDC_ZKYPXX_YPZZSD)->GetWindowText(ZKYPX_ktpwz);
	double grade = atof(ZKYPX_ktpwz);
	drill.grade = grade;

	int nindex = ZKYPXXLIST.InsertItem(1, ZKYPX_ypbh);
	ZKYPXXLIST.SetItemText(nindex, 1, ZKYPX_ktmc);
	ZKYPXXLIST.SetItemText(nindex, 2, ZKYPX_ktpwz);

	UserInsertDMZK04062(drill);
}
